﻿package com.zit.service;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.Session;
import org.hibernate.Transaction;

import com.zit.dao.BerthDAO;
import com.zit.entity.Bedroom;
import com.zit.entity.Berth;

public class BerthService extends BaseService {

	private BerthDAO berthDAO =new BerthDAO();
	/**
	 * 作者:王冲
	 * 功能:根据寝室Id查询寝室下面的所有床号
	 * @return
	 */
	public List<Berth> select(int bid){
		Session s = null;
		Transaction tx = null ;
		List<Berth> berths=new ArrayList<Berth>();;
		try {
			s = getSession();
			tx = s.beginTransaction();
			berths=berthDAO.select(bid, s);
			tx.commit();
		} catch (Exception e) {
			e.printStackTrace();
		}finally{
			s.close();
		}
		return berths;
	}
}
